c# iterate enum

45

Loop through enum C# -

enum Foos {
  Foo,
  Bar,
}

foreach(Foos val in Enum.GetValues(typeof(Foos))) {
  //Do whatever with the value :D
}

traversing an enum c# -

var values = Enum.GetValues(typeof(Foos)).Cast<Foos>();

c# iterate enum -

var values = Enum.GetValues(typeof(Foos));

c# iterate enum -

var values = Enum.GetValues(typeof(Foos));

Comments

Submit
0 Comments